Skip to content

ref(api): use token operationIds + summary for core + api endpoints#117337

Merged
betegon merged 8 commits into
masterfrom
api/operation-id-tokens-core
Jun 17, 2026
Merged

ref(api): use token operationIds + summary for core + api endpoints#117337
betegon merged 8 commits into
masterfrom
api/operation-id-tokens-core

Conversation

@betegon

@betegon betegon commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

operationId→token migration, batch 1 of 3 (core + api endpoints, 83 ops / 50 files). Moves the human sentence into summary and sets operation_id to a short camelCase REST token so the generated @sentry/api SDK gets clean names; docs titles/slugs stay byte-identical (derived from summary).

Most are straight CRUD (getOrganization, listProjectKeys, updateProject, …). Verb-corrected and ad-hoc overrides where the path couldn't express intent:

  • non-CRUD verbs: addProjectTeam, addOrganizationMember, linkProjectRepository, registerProjectServiceHook, provisionOrganizationScimV2User/Group
  • singleton GETs → get: getOrganizationProfilingFlamegraph, getOrganizationSessions, getOrganizationStatsSummary, getProjectEventSourceMapDebug
  • consistency/clarity: symbol-source detail ops singular (delete/updateProjectSymbolSource), listOrganizationTraceItemAttributes, listProjectDebugFiles

Test plan

  • prek green (ruff/flake8/mypy + @extend_schema response-type check).
  • CI api docs test regenerates + validates the spec (--fail-on-warn); operations show token operationIds with the sentence preserved as summary.

Related (operationId→token migration)

⚠️ Merge note: the schema publish job has no concurrency guard — don't merge the 3 batches simultaneously (caused a partial-release race last time). Space them out.

operationId->token migration, batch 1 of 3 (core + api endpoints, 83 ops).
Move the human sentence into summary= and set operation_id to a short
camelCase REST token for the @sentry/api SDK; docs title/slug stay identical
(derived from summary).

Ad-hoc overrides applied for path-driven awkwardness/consistency:
- SCIM provision matches the CRUD scim names (provisionOrganizationScimV2User/Group)
- symbol source detail ops singular (delete/updateProjectSymbolSource)
- listOrganizationTraceItemAttributes (singular Item), listProjectDebugFiles
@betegon betegon marked this pull request as ready for review June 16, 2026 09:33
@betegon betegon requested review from a team as code owners June 16, 2026 09:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 45cf4fc. Configure here.

Comment thread src/sentry/core/endpoints/scim/members.py Outdated
Comment thread src/sentry/core/endpoints/scim/members.py

@shellmayr shellmayr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall - the bots are right about the non-unique ids though

The SCIM member PUT and PATCH both had operation_id="updateOrganizationScimV2User"
(pre-existing: they shared the sentence operationId). PATCH is PUBLIC, PUT is
EXPERIMENTAL, so the public api-docs build never caught it — but it's an invalid
duplicate in the full schema. Give the experimental PUT a distinct id+summary
(replaceOrganizationScimV2User / "Replace an Organization Member's Attributes";
PUT = SCIM full replace).

Add tests/apidocs/test_operation_id_uniqueness.py: AST-scan every @extend_schema and
assert operation_id and summary are each unique across src/sentry (duplicate summary
= docs URL collision, since the reference slug derives from summary). Catches the
recurrence regardless of publish status; pure file scan, no spec generation.
@betegon betegon requested a review from a team as a code owner June 16, 2026 10:29
betegon added 5 commits June 16, 2026 14:06
Used a context manager when reading source files; the bare open().read()
leaked handles, which pytest surfaced as unraisable ResourceWarnings and
flagged the test as flaky in CI.
The operationId uniqueness test was AST-based solely to scope the summary
check away from OpenApiExample(summary=...). Split the two concerns:

- operation_id uniqueness: a plain regex scan (operation_id= appears only
  as an @extend_schema kwarg). Handles both quote styles so apostrophes in
  un-migrated sentence-style values aren't truncated.
- summary uniqueness: enforced in custom_postprocessing_hook, where each
  operation's real summary is directly available (no example nesting) and
  the check is correctly scoped to public/docs operations. Guards against
  docs-URL slug collisions; fails the api docs build.
- test_hooks.py: use module-level pytest functions for the summary checks
  (per tests/AGENTS.md 'use pytest, not unittest'); drop the dead setUp.
- test_operation_id_uniqueness.py: scan via pathlib, matching the canonical
  source-scan precedent (tests/sentry/test_no_create_or_update_usage.py).
Match the surrounding test_hooks.py structure (EndpointServersTest,
FixIssueRoutesTest) instead of bare module-level functions. Body keeps
pytest.raises + plain asserts like its siblings.
@betegon betegon requested a review from shellmayr June 16, 2026 15:16

@shellmayr shellmayr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@betegon betegon merged commit 7c1ccfd into master Jun 17, 2026
72 of 74 checks passed
@betegon betegon deleted the api/operation-id-tokens-core branch June 17, 2026 11:35
billyvg pushed a commit that referenced this pull request Jun 17, 2026
…117337)

## Summary

operationId→token migration, **batch 1 of 3** (core + api endpoints,
**83 ops / 50 files**). Moves the human sentence into `summary` and sets
`operation_id` to a short camelCase REST token so the generated
`@sentry/api` SDK gets clean names; docs titles/slugs stay
byte-identical (derived from `summary`).

Most are straight CRUD (`getOrganization`, `listProjectKeys`,
`updateProject`, …). Verb-corrected and ad-hoc overrides where the path
couldn't express intent:
- non-CRUD verbs: `addProjectTeam`, `addOrganizationMember`,
`linkProjectRepository`, `registerProjectServiceHook`,
`provisionOrganizationScimV2User`/`Group`
- singleton GETs → `get`: `getOrganizationProfilingFlamegraph`,
`getOrganizationSessions`, `getOrganizationStatsSummary`,
`getProjectEventSourceMapDebug`
- consistency/clarity: symbol-source detail ops singular
(`delete`/`updateProjectSymbolSource`),
`listOrganizationTraceItemAttributes`, `listProjectDebugFiles`

## Test plan
- prek green (ruff/flake8/mypy + `@extend_schema` response-type check).
- CI `api docs test` regenerates + validates the spec
(`--fail-on-warn`); operations show token operationIds with the sentence
preserved as `summary`.

## Related (operationId→token migration)
- Convention: #117285 · Merged: replays #117166, dashboards #117297,
discover #117302
- Docs SEO foundation: getsentry/sentry-docs#18322 (merged)
- Batches 2 & 3 to follow (issues/integrations/releases/workflow_engine;
preprod/monitors/sentry_apps/notifications/seer/feedback)

⚠️ Merge note: the schema publish job has no concurrency guard — **don't
merge the 3 batches simultaneously** (caused a partial-release race last
time). Space them out.
betegon added a commit that referenced this pull request Jun 17, 2026
…leases/workflow endpoints (#117339)

## Summary

operationId→token migration, **batch 2 of 3** (issues, integrations,
releases, workflow_engine — **62 ops / 38 files**). Sentence →
`summary`, `operation_id` → short camelCase REST token; docs
titles/slugs unchanged (derived from `summary`).

Overrides where the path/verb didn't capture intent:
- `resolveOrganizationEventId` / `resolveOrganizationShortId` (resolve
verb + `Id` casing)
- `upload{Organization,Project}ReleaseFile`,
`getOrganizationConfigIntegrations`
- `getProjectOwnership` kept consistent with `updateProjectOwnership`

Bulk operations correctly keep the plural form
(`deleteOrganizationIssues`, `updateOrganizationDetectors`,
`updateOrganizationWorkflows`) vs their singular detail counterparts.

## Test plan
- prek green; CI `api docs test` regenerates + validates the spec
(`--fail-on-warn`).

## Related
- Batch 1 (core+api): #117337 · Convention: #117285 · Merged: #117166
#117297 #117302
- Batch 3 (preprod/monitors/sentry_apps/notifications/seer/feedback) to
follow.

⚠️ Don't merge the batches simultaneously — the schema publish job has
no concurrency guard (caused a partial-release race before). Space them
out.
betegon added a commit that referenced this pull request Jun 18, 2026
…y_apps/notifications/seer/feedback endpoints (#117403)

## Summary

operationId→token migration, **batch 3 of 3** (preprod, monitors,
sentry_apps, notifications, seer, feedback — **35 ops / 22 files**).
Sentence → `summary`, `operation_id` → short camelCase REST token; docs
titles/slugs unchanged (derived from `summary`).

Overrides:
- `startOrganizationIssueAutofix` / `getOrganizationIssueAutofixState`
(seer)
- unified all preprod ops to `PreprodArtifact` casing (structural
produced inconsistent `Preprodartifacts`), and fixed the latest-base
singleton to `getOrganizationPreprodArtifactSnapshotLatestBase` (was a
mislabeled `list`)

monitors map to the `Detector`/`Monitor` paths as-is;
notifications-action ops are self-consistent.

## Test plan
- prek green; CI `api docs test` regenerates + validates the spec
(`--fail-on-warn`).

## Related
- Batch 1 (core+api): #117337 · Batch 2
(issues/integrations/releases/workflow): #117339
- Convention: #117285 · Merged: #117166 #117297 #117302

⚠️ Don't merge the batches simultaneously — the schema publish job has
no concurrency guard (caused a partial-release race before). Space them
out (merge one, wait for its `openapi` publish, then the next).
sehr-m pushed a commit that referenced this pull request Jun 23, 2026
…117337)

## Summary

operationId→token migration, **batch 1 of 3** (core + api endpoints,
**83 ops / 50 files**). Moves the human sentence into `summary` and sets
`operation_id` to a short camelCase REST token so the generated
`@sentry/api` SDK gets clean names; docs titles/slugs stay
byte-identical (derived from `summary`).

Most are straight CRUD (`getOrganization`, `listProjectKeys`,
`updateProject`, …). Verb-corrected and ad-hoc overrides where the path
couldn't express intent:
- non-CRUD verbs: `addProjectTeam`, `addOrganizationMember`,
`linkProjectRepository`, `registerProjectServiceHook`,
`provisionOrganizationScimV2User`/`Group`
- singleton GETs → `get`: `getOrganizationProfilingFlamegraph`,
`getOrganizationSessions`, `getOrganizationStatsSummary`,
`getProjectEventSourceMapDebug`
- consistency/clarity: symbol-source detail ops singular
(`delete`/`updateProjectSymbolSource`),
`listOrganizationTraceItemAttributes`, `listProjectDebugFiles`

## Test plan
- prek green (ruff/flake8/mypy + `@extend_schema` response-type check).
- CI `api docs test` regenerates + validates the spec
(`--fail-on-warn`); operations show token operationIds with the sentence
preserved as `summary`.

## Related (operationId→token migration)
- Convention: #117285 · Merged: replays #117166, dashboards #117297,
discover #117302
- Docs SEO foundation: getsentry/sentry-docs#18322 (merged)
- Batches 2 & 3 to follow (issues/integrations/releases/workflow_engine;
preprod/monitors/sentry_apps/notifications/seer/feedback)

⚠️ Merge note: the schema publish job has no concurrency guard — **don't
merge the 3 batches simultaneously** (caused a partial-release race last
time). Space them out.
sehr-m pushed a commit that referenced this pull request Jun 23, 2026
…leases/workflow endpoints (#117339)

## Summary

operationId→token migration, **batch 2 of 3** (issues, integrations,
releases, workflow_engine — **62 ops / 38 files**). Sentence →
`summary`, `operation_id` → short camelCase REST token; docs
titles/slugs unchanged (derived from `summary`).

Overrides where the path/verb didn't capture intent:
- `resolveOrganizationEventId` / `resolveOrganizationShortId` (resolve
verb + `Id` casing)
- `upload{Organization,Project}ReleaseFile`,
`getOrganizationConfigIntegrations`
- `getProjectOwnership` kept consistent with `updateProjectOwnership`

Bulk operations correctly keep the plural form
(`deleteOrganizationIssues`, `updateOrganizationDetectors`,
`updateOrganizationWorkflows`) vs their singular detail counterparts.

## Test plan
- prek green; CI `api docs test` regenerates + validates the spec
(`--fail-on-warn`).

## Related
- Batch 1 (core+api): #117337 · Convention: #117285 · Merged: #117166
#117297 #117302
- Batch 3 (preprod/monitors/sentry_apps/notifications/seer/feedback) to
follow.

⚠️ Don't merge the batches simultaneously — the schema publish job has
no concurrency guard (caused a partial-release race before). Space them
out.
sehr-m pushed a commit that referenced this pull request Jun 23, 2026
…y_apps/notifications/seer/feedback endpoints (#117403)

## Summary

operationId→token migration, **batch 3 of 3** (preprod, monitors,
sentry_apps, notifications, seer, feedback — **35 ops / 22 files**).
Sentence → `summary`, `operation_id` → short camelCase REST token; docs
titles/slugs unchanged (derived from `summary`).

Overrides:
- `startOrganizationIssueAutofix` / `getOrganizationIssueAutofixState`
(seer)
- unified all preprod ops to `PreprodArtifact` casing (structural
produced inconsistent `Preprodartifacts`), and fixed the latest-base
singleton to `getOrganizationPreprodArtifactSnapshotLatestBase` (was a
mislabeled `list`)

monitors map to the `Detector`/`Monitor` paths as-is;
notifications-action ops are self-consistent.

## Test plan
- prek green; CI `api docs test` regenerates + validates the spec
(`--fail-on-warn`).

## Related
- Batch 1 (core+api): #117337 · Batch 2
(issues/integrations/releases/workflow): #117339
- Convention: #117285 · Merged: #117166 #117297 #117302

⚠️ Don't merge the batches simultaneously — the schema publish job has
no concurrency guard (caused a partial-release race before). Space them
out (merge one, wait for its `openapi` publish, then the next).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants